﻿
Imports std

Public Class spreadDistributor
    Inherits distributor

    Private ReadOnly waitall As Boolean = True

    Protected Sub New(ByVal waitall As Boolean)
        Me.waitall = waitall
    End Sub

    Public Sub New()
        Me.New(True)
    End Sub

    Protected Overrides Function aggregate(ByVal targetJobs() As indexedJob, ByVal inputJob As ijob) As Boolean
        Return first_finish_aggregate(targetJobs, inputJob)
    End Function

    Protected Overrides Function distribute(ByVal inputJob As ijob,
                                            ByVal targetJobs As vector(Of pair(Of UInt32, ijob)),
                                            ByRef waitall As Boolean) As Boolean
        waitall = Me.waitall
        Return spread_distribute(inputJob, targetJobs)
    End Function
End Class
